<html>
<head><meta charset="utf-8"><title>-Clto=thin · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Clto.3Dthin.html">-Clto=thin</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="206530104"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Clto%3Dthin/near/206530104" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mike Hommey <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Clto.3Dthin.html#206530104">(Aug 11 2020 at 00:44)</a>:</h4>
<p>Before I open an issue, am I wrong expecting that the output from using -Clto and -Clto=thin on a staticlib crate should be structurally identical? Because they currently aren't. The former creates one .o for all of the generated code, while the former creates a .o per crate, like without LTO.</p>



<a name="206535206"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Clto%3Dthin/near/206535206" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Clto.3Dthin.html#206535206">(Aug 11 2020 at 02:39)</a>:</h4>
<p>Thin lto produces the same number of object file outputs as there were imports</p>



<a name="206535251"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Clto%3Dthin/near/206535251" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Clto.3Dthin.html#206535251">(Aug 11 2020 at 02:40)</a>:</h4>
<p>What it does is inlining across objects then optimizes in parallel</p>



<a name="206535267"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Clto%3Dthin/near/206535267" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Clto.3Dthin.html#206535267">(Aug 11 2020 at 02:40)</a>:</h4>
<p>But in any case it's expected the structure is different</p>



<a name="206536013"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Clto%3Dthin/near/206536013" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mike Hommey <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Clto.3Dthin.html#206536013">(Aug 11 2020 at 03:02)</a>:</h4>
<p>I would have expected the same "flattened" output, with thin vs. flat being an implementation detail of how the compiler gets there.</p>



<a name="206536099"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Clto%3Dthin/near/206536099" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mike Hommey <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Clto.3Dthin.html#206536099">(Aug 11 2020 at 03:04)</a>:</h4>
<p>Note that I'm talking about staticlib, where the .a contains machine code, not llvm IR</p>



<a name="206554790"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Clto%3Dthin/near/206554790" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Connor Horman <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Clto.3Dthin.html#206554790">(Aug 11 2020 at 09:16)</a>:</h4>
<p>If its using lto, wouldn't the .a contain llir, by design?</p>



<a name="206624372"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Clto%3Dthin/near/206624372" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mike Hommey <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Clto.3Dthin.html#206624372">(Aug 11 2020 at 20:04)</a>:</h4>
<p>Not for staticlib crates</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>